package cm.server.controller;

import cm.server.dao.SensorPositionRepository;
import cm.server.entity.SensorPosition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zy
 * @description
 * @date 2021/4/12 14:19
 */
@RestController
@RequestMapping("sensorPosition")
@CrossOrigin
public class SensorPositionController {
    @Autowired
    private SensorPositionRepository sensorPositionRepository;

    @RequestMapping(value = "allsensor", method = RequestMethod.GET)
    public List<SensorPosition> allSensor(int floor) {
        return sensorPositionRepository.findAllByFloor(floor);
    }
}
